'''
Created on 2013-6-13

@author: leowang
'''
gLogLevel = 'debug'

class Logger(object):
    '''
    Function:The CI System Logger
    '''

    def __init__(self):
        '''
        Constructor
        '''
        self.LogLevelValueDict = {"debug":0,"info":1,"warning":2,"error":3,"critical":4}
        self.mLogLevel = gLogLevel
        
    def SetLogLevel(self, LogLevel):
        self.mLogLevel = LogLevel
        
    def GetLogLevel(self):
        return self.mLogLevel
    
    def IsNeedToLogging(self, LogLevel):
        return self.LogLevelValueDict[LogLevel] > self.LogLevelValueDict[self.mLogLevel]
    
    def Logging(self,LogLevel,Msg):
        if self.IsNeedToLogging(LogLevel):
            print "[%s]%s"%(LogLevel,Msg)
